import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'
Vue.use(Vuex)
const debug = process.env.NODE_ENV !== 'production'

export default new Vuex.Store({
  state: {
    userInfo: 'zsk',
    userAge: 10
  },
  getters: {
    userInfoCore: state => {
      return `${state.userInfo}`
    },
    userAge: state => {
      return state.userAge
    }
  },
  mutations: {
    SET_USERINFO (state, query) {
      state.userInfo = query
    }
  },
  actions: {
    setUserInfo (context, query) {
      context.commit('SET_USERINFO', query)
    }
  },
  strict: debug,
  plugins: debug ? [createLogger()] : []
})
